package priv.stones.io.Scanner.file;

import java.io.*;

/**
 * @Author: Stones
 * @Description:内存流
 * @Date: 2017/11/1 11:05
 */
public class MemoryIo1 {

    public static void main(String[] args) throws IOException {
        String str = "测试一下内存流";
        InputStream inputStream = new ByteArrayInputStream(str.getBytes());
        OutputStream outputStream = new ByteArrayOutputStream();
        int temp;
        while ((temp = inputStream.read()) != -1) {
            outputStream.write(temp);
        }
        System.out.println(outputStream);
        inputStream.close();
        outputStream.close();
    }

}
